package club.zhilin.guli.service.ucenter.controller.backend;

import club.zhilin.guli.common.base.result.CommonResult;
import club.zhilin.guli.service.ucenter.service.IMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhilin
 * @since 2022/3/5 22:41
 */
@Slf4j
@Api(tags = "会员管理")
@RestController
@RequestMapping("/admin/ucenter/member")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MemberController {

    private final IMemberService iMemberService;

    @ApiOperation(value = "根据日期统计注册人数")
    @GetMapping("/count/register/{date}")
    public CommonResult<Integer> countRegister(@PathVariable String date) {
        return CommonResult.success(iMemberService.selectRegisterCount(date));
    }

    @ApiOperation(value = "根据日期统计登录人数")
    @GetMapping("/count/login/{date}")
    public CommonResult<Integer> countLogin(@PathVariable String date) {
        return CommonResult.success(iMemberService.selectLoginCount(date));
    }
}
